package com.swx.generate.dto;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotBlank;

/**
 * @author ricky
 * @date 2021/8/26
 */
@Data
public class ServerUrlDTO {
    @NotBlank(message = "serverUrl-不能为空")
    private String serverUrl;

    public String getUrl() {
        if (serverUrl.startsWith("http")) {
            return StringUtils.removeEnd(serverUrl, "/");
        }
        return "http://" + StringUtils.removeEnd(serverUrl, "/");
    }
}
